This is the readme file for the replication materials for "Democracy, Inequality, and Antitrust" by Michael O. Allen (michael.allen@stanford.edu), Kenneth Scheve (kenneth.scheve@yale.edu), and David Stasavage (david.stasavage@nyu.edu).

Latest revision: 2024-12-29

# Scripts
These replication materials are designed to be run after opening the "democracy inequality antitrust jop.Rproj" project file with RStudio. Otherwise, you will need to set the working directory to the folder containing this readme file prior to running each R script. The Stata do files require assigning this folder as the working directory as well. The code to recreate all of the figures and tables in the paper can be found in the "scripts/" folder. The output for each script will be saved in either the "output/figures/" or "output/tables/" folder with a filename that reflects its label in the main text or appendix. 

# Data
The "data/" folder contains the datasets used to recreate the analyses presented in the text.

# Output - Tables, figures and logs
Below I list all of the original tables and figures included in the main text and appendix along with the filename of the R or Stata script that can be used to replicate each. Each script can be run on its own. The resulting table or figure is stored in the "output" folder with a filename corresponding to its table/figure label in the text/appendix. Log files are named after the relevant script. Below is a list of all figures and tables in the main text and appendix along with the script that can be used to recreate it.

## Main Text
### Figures
 - Figures 1a and 1b: figure-1ab.R
 - Figure 2: analysis.R 
 - Figure 3: analysis.R  
 - Figures 4a and 4b: figure-4.R  

### Tables:
 - Table 1: analysis.R  
 - Table 2: table-2.do  

## Appendix
### Figures
 - Figure B1: analysis.R  
 - Figure B2: analysis.R  
 - Figure D1: analysis.R  
 - Figure E1: figure-e1.do
 - Figure F1: analysis.R  
 - Figure F2: analysis.R  
 - Figure G1: analysis.R  
 - Figure G2: analysis.R  

### Tables
 - Table A1: analysis.R  
 - Table A2: analysis.R  
 - Table B1: analysis.R  
 - Table B2: analysis.R  
 - Table B3: analysis.R  
 - Table B4: analysis.R  
 - Table B5: analysis.R  
 - Table C1: analysis.R 
 - Table D1: analysis.R  

# Environment
The replication package was created and last run using macOS 15.1.1 with R version 4.3.1 and StataMP 17.

## Main R Package versions
PanelMatch (2.0.1)

fixest (0.11.1)

marginaleffects (0.15.1)

interflex (1.2.6)

data.table (1.15.0)

modelsummary (1.4.1)

ggplot2 (3.5.1)

xtable (1.8-4)

here (1.0.1)

cowplot (1.1.1)